import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// 按需引入 element-plus
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // ...
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],

  // 服务器配置
  server: {
    port: 9797,
    // 反向代理解决跨域
    host: 'localhost',
    open:true,
    proxy: {
      '/api/v1/doctor/': {
        target: 'http://10.7.164.51:10777',
        // target: 'http://localhost:10777'
      }
    }
  }
})
